package com.liang.cloud.Util;


import com.liang.cloud.Vo.ResultVo;

/**
 * @author: 余亮亮
 * @description:
 * @create: 2019-12-28 12:58:59
 **/
public class ResultVoUtil {


    /**
     * 返回带数据的成功
     * @param object
     * @return
     */
    public static ResultVo success(Object object){
        ResultVo resultVo = new ResultVo();
        resultVo.setCode(0);
        resultVo.setMsg("成功");
        resultVo.setData(object);
        return resultVo;
    }
    /**
     * 无数据返回的成功
     * @return
     */
    public static ResultVo success(){
        return success(null);
    }

    /**
     * 自定义返回错误结果
     * @param code
     * @param msg
     * @return
     */
    public static ResultVo error(Integer code,String msg){
        ResultVo resultVo = new ResultVo();
        resultVo.setCode(code);
        resultVo.setMsg(msg);
        return resultVo;
    }

}
